<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class AlterStaffAddDateEnroll extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('staff', function (Blueprint $table) {
            if(!Schema::hasColumn('staff','date_enroll')){
                $table->date('date_enroll')->nullable();
            }
            if(!Schema::hasColumn('staff','work_years')){
                $table->tinyInteger('work_years')->nullable();
            }
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('staff', function (Blueprint $table) {
            $table->dropColumn('date_enroll');
            $table->dropColumn('work_years');
        });
    }
}
